<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: SearchBuilder</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">SearchBuilder</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/plugins/railswhere/lib/search_builder_rb.html">
                vendor/plugins/railswhere/lib/search_builder.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000026">and_unless_blank</a>&nbsp;&nbsp;
      <a href="#M000028">cast_to</a>&nbsp;&nbsp;
      <a href="#M000029">cast_to</a>&nbsp;&nbsp;
      <a href="#M000019">delegate_to</a>&nbsp;&nbsp;
      <a href="#M000023">equal_on</a>&nbsp;&nbsp;
      <a href="#M000022">for_table</a>&nbsp;&nbsp;
      <a href="#M000024">in_on</a>&nbsp;&nbsp;
      <a href="#M000021">like_on</a>&nbsp;&nbsp;
      <a href="#M000018">new</a>&nbsp;&nbsp;
      <a href="#M000017">object=</a>&nbsp;&nbsp;
      <a href="#M000025">process_clause</a>&nbsp;&nbsp;
      <a href="#M000020">range_on</a>&nbsp;&nbsp;
      <a href="#M000027">value_for</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">object</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">where</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000029" class="method-detail">
        <a name="M000029"></a>

        <div class="method-heading">
          <a href="#M000029" class="method-signature">
          <span class="method-name">cast_to</span><span class="method-args">(value, type)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000029-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 112</span>
112:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cast_to</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">type</span>)
113:     <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
114:     
115:     <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
116:     <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>
117:       <span class="ruby-identifier">value</span>
118:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:array</span>
119:       <span class="ruby-identifier">value</span> = <span class="ruby-constant">Array</span><span class="ruby-operator">===</span><span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-identifier">value</span> <span class="ruby-operator">:</span> [<span class="ruby-identifier">value</span>]
120:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>
121:       <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">value</span>)
122:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>
123:       <span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">to_date</span>
124:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:i</span>, <span class="ruby-identifier">:int</span>, <span class="ruby-identifier">:integer</span>
125:       <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_i</span>
126:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:f</span>, <span class="ruby-identifier">:float</span>
127:       <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_f</span>
128:     <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>
129:       <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>
130:     <span class="ruby-keyword kw">else</span>
131:       <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;unknown cast type: #{type}&quot;</span>
132:     <span class="ruby-keyword kw">end</span>
133:     
134:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">delegate_to</span><span class="method-args">(object_name, methods = [])</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 17</span>
17:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delegate_to</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">methods</span> = [])
18:     <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">method_name</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">methods</span>
19:       <span class="ruby-identifier">class_eval</span> <span class="ruby-value str">&quot;def \#{method_name}(*params, &amp;block)\n\#{object_name} &amp;&amp; \#{object_name}.\#{method_name}(*params, &amp;block)\nend\n&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span> <span class="ruby-operator">+</span><span class="ruby-value">1</span>
20:     <span class="ruby-keyword kw">end</span>
21:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(target_object, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 11</span>
11:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">target_object</span>, <span class="ruby-identifier">options</span>={})
12:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">object</span> = <span class="ruby-identifier">target_object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">target_object</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">target_object</span>
13:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">where</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:append_to</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Where</span>.<span class="ruby-identifier">new</span>
14:     <span class="ruby-ivar">@table_prefix</span> = <span class="ruby-value str">&quot;&quot;</span>
15:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">and_unless_blank</span><span class="method-args">(condition, value, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 83</span>
83:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">and_unless_blank</span>(<span class="ruby-identifier">condition</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span>={})
84:     <span class="ruby-identifier">value</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">compact</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">value</span>)
85:     
86:     <span class="ruby-comment cmt"># if value is an empty array or a blank string, don't filter on it</span>
87:     <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">blank?</span>
88:     
89:     <span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:prefix</span>]
90:     <span class="ruby-identifier">suffix</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:suffix</span>]
91:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prefix</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">suffix</span>
92:       <span class="ruby-ivar">@where</span>.<span class="ruby-identifier">and</span>(<span class="ruby-identifier">condition</span>, [<span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">suffix</span>].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">to_s</span> )
93:     <span class="ruby-keyword kw">else</span>
94:       <span class="ruby-ivar">@where</span>.<span class="ruby-identifier">and</span>(<span class="ruby-identifier">condition</span>, <span class="ruby-identifier">value</span>)
95:     <span class="ruby-keyword kw">end</span>
96:     
97:     <span class="ruby-keyword kw">self</span>
98:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="#M000028" class="method-signature">
          <span class="method-name">cast_to</span><span class="method-args">(value, type)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000028-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 108</span>
108:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cast_to</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">type</span>)
109:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">cast_to</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">type</span>)
110:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">equal_on</span><span class="method-args">(field, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 64</span>
64:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">equal_on</span>(<span class="ruby-identifier">field</span>, <span class="ruby-identifier">options</span>={})
65:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">clone</span>
66:     <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:cast</span>] = <span class="ruby-identifier">:string</span>
67:     <span class="ruby-identifier">process_clause</span>(<span class="ruby-identifier">field</span>, <span class="ruby-value str">&quot;= ?&quot;</span>, <span class="ruby-identifier">options</span>)
68:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">for_table</span><span class="method-args">(table) {|| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 49</span>
49:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">for_table</span>(<span class="ruby-identifier">table</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
50:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
51:       <span class="ruby-identifier">last_table_prefix</span> = <span class="ruby-ivar">@table_prefix</span>
52:     <span class="ruby-keyword kw">end</span>
53:     
54:     <span class="ruby-ivar">@table_prefix</span> = <span class="ruby-node">&quot;#{table}.&quot;</span>
55:       
56:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
57:       <span class="ruby-keyword kw">yield</span>
58:       
59:       <span class="ruby-ivar">@table_prefix</span> = <span class="ruby-identifier">last_table_prefix</span>
60:     <span class="ruby-keyword kw">end</span>
61:     
62:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">in_on</span><span class="method-args">(field, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 70</span>
70:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">in_on</span>(<span class="ruby-identifier">field</span>, <span class="ruby-identifier">options</span>={})
71:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">clone</span>
72:     <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:cast</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">:array</span>
73:     <span class="ruby-identifier">process_clause</span>(<span class="ruby-identifier">field</span>, <span class="ruby-value str">&quot;in (?)&quot;</span>, <span class="ruby-identifier">options</span>)
74:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">like_on</span><span class="method-args">(field, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 42</span>
42:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">like_on</span>(<span class="ruby-identifier">field</span>, <span class="ruby-identifier">options</span>={})
43:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">clone</span>
44:     <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:suffix</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;%&quot;</span>
45:     
46:     <span class="ruby-identifier">process_clause</span>(<span class="ruby-identifier">field</span>, <span class="ruby-value str">&quot;like ?&quot;</span>, <span class="ruby-identifier">options</span>)
47:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">object=</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 6</span>
6:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">object=</span>(<span class="ruby-identifier">value</span>)
7:     <span class="ruby-identifier">value</span>=<span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Hash</span><span class="ruby-operator">===</span><span class="ruby-identifier">value</span>
8:     <span class="ruby-ivar">@object</span> = <span class="ruby-identifier">value</span>
9:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">process_clause</span><span class="method-args">(field, operator_clause, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 76</span>
76:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_clause</span>(<span class="ruby-identifier">field</span>, <span class="ruby-identifier">operator_clause</span>, <span class="ruby-identifier">options</span>={})
77:     <span class="ruby-identifier">param</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:param</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">field</span>
78:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">and_unless_blank</span>(<span class="ruby-node">&quot;#{@table_prefix}#{field} #{operator_clause}&quot;</span>, <span class="ruby-identifier">value_for</span>(<span class="ruby-identifier">param</span>, <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:cast</span>]), <span class="ruby-identifier">options</span>)
79:     
80:     <span class="ruby-keyword kw">self</span>
81:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">range_on</span><span class="method-args">(field, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 30</span>
30:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range_on</span>(<span class="ruby-identifier">field</span>, <span class="ruby-identifier">options</span>={})
31:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">clone</span>
32:     <span class="ruby-identifier">min_param</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:min_param</span>] <span class="ruby-operator">||</span> <span class="ruby-node">&quot;#{options[:param] || field}_min&quot;</span>
33:     <span class="ruby-identifier">max_param</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:max_param</span>] <span class="ruby-operator">||</span> <span class="ruby-node">&quot;#{options[:param] || field}_max&quot;</span>
34:     <span class="ruby-identifier">cast</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:cast</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:string</span>
35:     
36:     <span class="ruby-identifier">process_clause</span>(<span class="ruby-identifier">field</span>, <span class="ruby-value str">&quot;&gt;= ?&quot;</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:param</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_param</span>))
37:     <span class="ruby-identifier">process_clause</span>(<span class="ruby-identifier">field</span>, <span class="ruby-value str">&quot;&lt;= ?&quot;</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:param</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_param</span>))
38:     
39:     <span class="ruby-keyword kw">self</span>
40:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">value_for</span><span class="method-args">(param, cast=:string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/railswhere/lib/search_builder.rb, line 100</span>
100:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value_for</span>(<span class="ruby-identifier">param</span>, <span class="ruby-identifier">cast</span>=<span class="ruby-identifier">:string</span>)
101:     <span class="ruby-identifier">param</span> = <span class="ruby-identifier">param</span>.<span class="ruby-identifier">to_s</span>
102:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">param</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;.&quot;</span>)
103:       <span class="ruby-identifier">param</span>=<span class="ruby-identifier">param</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;.&quot;</span>).<span class="ruby-identifier">last</span>
104:     <span class="ruby-keyword kw">end</span>
105:     <span class="ruby-identifier">cast_to</span>( <span class="ruby-identifier">object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">param</span>), <span class="ruby-identifier">cast</span>)
106:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>